package se.webbzon.boltzmann.battle.object.spawner;

import se.webbzon.boltzmann.resource.Resources;
import se.webbzon.oschi01.worldeditor.DeflatableWorldObject;
import se.webbzon.oschi01.worldeditor.WorldObjectDeflation;
import se.webbzon.oschi01.worldobject.WorldStaticObject;
import se.webbzon.oschi01.worldobject.appearance.Appearance3D;
import se.webbzon.oschi01.worldobject.appearance.CubeAppearance3D;
import se.webbzon.oschi01.worldobject.appearance.SimpleAppearance3D;

public class BattleSpawner extends WorldStaticObject implements DeflatableWorldObject {

	// The name of the deflatable world object
	public static final String worldObjectName = "battleSpawner";
	
	// The faction and group id of the spawner and the order number of the spawner
	private int factionId, groupId, order;
	
	// The facing of the spawner
	private boolean facingLeft;
	
	/*============================================================
	Constructors
	============================================================*/
	
	public BattleSpawner(int factionId, int groupId, int order, boolean facingLeft) {
		super(0, createAppearance());
		this.factionId = factionId;
		this.groupId = groupId;
		this.order = order;
		this.facingLeft = facingLeft;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the faction id of the spawner. **/
	public int getFactionId() {
		return factionId;
	}
	
	/** Sets the faction id of the spawner. **/
	public void setFactionId(int factionId) {
		this.factionId = factionId;
	}
	
	/** Returns the group id of the spawner. **/
	public int getGroupId() {
		return groupId;
	}
	
	/** Sets the group id of the spawner. **/
	public void setGroupId(int groupId) {
		this.groupId = groupId;
	}
	
	/** Returns the order number of the spawner. **/
	public int getOrder() {
		return order;
	}
	
	/** Sets the order number of the spawner. **/
	public void setOrder(int order) {
		this.order = order;
	}
	
	/** Returns true if the spawner is facing left. **/
	public boolean isFacingLeft() {
		return facingLeft;
	}
	
	/** Sets whatever the spawner is facing left. **/
	public void setFacingLeft(boolean facingLeft) {
		this.facingLeft = facingLeft;
	}

	@Override public String getName() {
		return worldObjectName;
	}

	@Override public WorldObjectDeflation getDeflation() {
		return new BattleSpawnerDeflation(0,this);
	}
	
	/*============================================================
	Private Methods
	============================================================*/
	
	private static final Appearance3D createAppearance() {
		SimpleAppearance3D appearance = new CubeAppearance3D();
		appearance.setTextureSet(Resources.getTextureSet("misc_unknown"));
		return appearance;
	}

}
